From 1d4cecd73224807ccb48813c5d143c53527092f1 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 27 Aug 2025 01:09:58 +0000 Subject: [PATCH] Bug 1983736 - Patch jsonschema to work with Python 3.14+ r=mach-reviewers,ahal,ahochheiden Differential Revision: https://phabricator.services.mozilla.com/D262335 Gbp-Pq: Topic fixes Gbp-Pq: Name Bug-1983736-Patch-jsonschema-to-work-with-Python-3.1.patch --- python/mozbuild/mozbuild/vendor/vendor_python.py | 4 ++++ third_party/python/jsonschema/jsonschema/validators.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/mozbuild/mozbuild/vendor/vendor_python.py b/python/mozbuild/mozbuild/vendor/vendor_python.py index 9acee946fc4..2801e1b685d 100644 --- a/python/mozbuild/mozbuild/vendor/vendor_python.py +++ b/python/mozbuild/mozbuild/vendor/vendor_python.py @@ -40,6 +40,10 @@ EXCLUDED_PACKAGES = { # modified 'dummy' version of it so that the dependency checks still succeed, but # if it ever is attempted to be used, it will fail gracefully. "ansicon", + # jsonschema 4.17.3 is incompatible with Python 3.14+, + # but later versions use a dependency with Rust components, which we thus can't vendor. + # For now we apply the minimal patch to jsonschema to make it work again. + "jsonschema", } diff --git a/third_party/python/jsonschema/jsonschema/validators.py b/third_party/python/jsonschema/jsonschema/validators.py index 66e803ea2d0..88316a8bb72 100644 --- a/third_party/python/jsonschema/jsonschema/validators.py +++ b/third_party/python/jsonschema/jsonschema/validators.py @@ -875,8 +875,11 @@ class RefResolver: return None uri, fragment = urldefrag(url) for subschema in subschemas: + id = subschema["$id"] + if not isinstance(id, str): + continue target_uri = self._urljoin_cache( - self.resolution_scope, subschema["$id"], + self.resolution_scope, id, ) if target_uri.rstrip("/") == uri.rstrip("/"): if fragment: -- 2.30.2